package com.scs.application;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.Banner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.ApplicationPidFileWriter;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableAsync
@SpringBootApplication
@EnableTransactionManagement
@MapperScan({"com.scs.application.modules.*.mapper","com.scs.application.modules.thirdparty.*.mapper"})

public class ScpApplication {

    public static void main(String[] args) {
        /**
         * Springboot整合Elasticsearch 在项目启动前设置一下的属性，防止报错
         * 解决netty冲突后初始化client时还会抛出异常
         * java.lang.IllegalStateException: availableProcessors is already set to [4], rejecting [4]
         * {@link org.elasticsearch.transport.netty4.Netty4Utils#setAvailableProcessors(int)}
         */
        System.setProperty("es.set.netty.runtime.available.processors", "false");

        new SpringApplicationBuilder(ScpApplication.class)
                .bannerMode(Banner.Mode.OFF)
                .listeners(new ApplicationPidFileWriter())
                .run(args);
    }

}
